import pygame
from pygame.sprite import Sprite

class Alien(Sprite):
    ''' 外星人 '''

    def __init__(self, screen, x=0, y=0):
        
        super().__init__()
    
        self.screen = screen
        self.img = pygame.image.load('static/alien.png')
        self.rect= self.img.get_rect()

        self.screen_rect = screen.get_rect()

        self.rect.y = y or self.screen_rect.centery
        self.rect.x = x or self.screen_rect.right

    def update(self):
        self.rect.x -= 2
    
    def blitme(self):
        ''' 构建外星人 '''
        self.screen.blit(self.img, self.rect)




